/*
 * @Author: chululu 83503768@qq.com
 * @Date: 2025-01-23 11:29:42
 * @LastEditors: chululu 83503768@qq.com
 * @LastEditTime: 2025-01-24 16:55:33
 * @FilePath: \tumor-big-screen\src\three\animation.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
// animation.js
import { gsap } from "gsap";

export function startAnimation(camera, personModel, LungGroup) {
  return new Promise((resolve) => {
    gsap.to(camera.position, {
      duration: 2,
      z: 1.5,
      x: camera.position.x, // 保持现有 x 位置
      y: camera.position.y, // 保持现有 y 位置
      ease: "power2.out",
    });
    personModel.rotation.set(0, -Math.PI / 2, 0);
    gsap.to(personModel.rotation, {
      duration: 2,
      x: Math.PI / 4,
      z: Math.PI / 4,
      y: (-3 * Math.PI) / 4,
      ease: "power2.out",
      onComplete: () => {
        // 动画结束后，移动 LungGroup
        gsap.to(LungGroup.position, {
          duration: 2,
          z: 50,
          ease: "power2.out",
          onComplete: resolve,
        });
      },
    });
  });


}
